# Plot frequency response
import control  # pip install control
import matplotlib.pyplot as plt
import math
import numpy as np

sysTfList = []
sysTfList.append(control.tf([1], [1, 0.4, 0]))
mag, phase, omega = control.bode(
    sysTfList,
    omega=np.logspace(start=-2, stop=1, num=200),
    dB=False,
    deg=True,
    plot=False,
)
plt.plot(omega, mag)
phase1 = 180 / math.pi * phase  # to degree
plt.plot(omega, phase1)
w = [0.1 * math.pi, 0.4 * math.pi, 0.8 * math.pi, math.pi, 2 * math.pi]
A = [6.1427, 0.60, 0.16, 0.1004, 0.04]
# A = 20 * np.log10(A)
Phai = [-126, -161.50, -169.34, -171, -183.60]
plt.plot(w, A, "o")
plt.plot(w, Phai, "o")
plt.show()
